Component({
  properties: {
    num: { type: String }
  },
  data: {
    color: "#7A7E83",
    selectedColor: "#3cc51f",
    roles: false,
    conmonlist: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页"
      },
      {
        "pagePath": "/pages/user/user",
        "text": "我的"
      }
    ],
    list: [
      {
        "pagePath": "/pages/index/index",
        "text": "首页"
      },
      {
        "pagePath": "/pages/createTask/createTask",
        "text": "发布"
      },
      {
        "pagePath": "/pages/audit/audit",
        "text": "审核"
      },
      {
        "pagePath": "/pages/management/management",
        "text": "管理"
      },
      {
        "pagePath": "/pages/user/user",
        "text": "我的"
      }
    ]
  },
  attached() {
   let role = wx.getStorageSync('userMsg').roleList
    if (role === "role_admin" || role === "role_superAdmin"){
      this.setData({
        roles:true
      })
    }else{
      this.setData({
        roles: false
      })
      // wx.navigateTo({ url:'../index/index' })
    }
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.reLaunch({ url })
    }
  },
})